package org.sl.flvplayer.flyweights {
	import flash.net.URLRequest;

	/**
	 * Flyweight Icon provides the path and the position of a watermark or icon.
	 * 
	 * @package org.sl.flvplayer.flyweights
	 * @author Dan
	 * @version 
	 * @see org.sl.flvplayer.data.VideoItem
	 */ 
	public class FWIcon {

		public static const TL : String = "top left";
		public static const TC : String = "top center";
		public static const TR : String = "top right";
		public static const CL : String = "center left";
		public static const CC : String = "center center";
		public static const CR : String = "center right";
		public static const BL : String = "bottom left";
		public static const BC : String = "bottom center";
		public static const BR : String = "bottom right";	

		private var _iconURL : URLRequest;
		private var _iconPos : String;

		/**
		 * @param p_iconValue path to the image source
		 * @param p_iconPos position of the image	
		 */		
		public function FWIcon(p_iconValue : String, p_iconPos : String = "") {
			_iconURL = new URLRequest(p_iconValue);
			
			if(p_iconPos != "") _iconPos = getPosFromString(p_iconPos);
		}

		/**
		 * @param p_iconValue
		 */
		private function set iconURL(p_iconValue : URLRequest) : void {
			_iconURL = p_iconValue;
		}

		/**
		 * @return
		 */
		public function get iconURL() : URLRequest {
			return _iconURL;
		}

		/**
		 * @param p_iconValue
		 */
		private function set iconPos(p_iconValue : String) : void {
			_iconPos = p_iconValue;
		}

		/** 
		 * @return 
		 */
		public function get iconPos() : String {
			return _iconPos;
		}

		/**
		 * @param p_posString
		 * @return
		 */
		private function getPosFromString(p_posString : String) : String {
			switch(p_posString.toUpperCase()) {
					
				case"TL":
					return TL;
				
				case"TC":
					return TC;
				
				case"TR":
					return TR;				
					
				case"CL":
					return CL;
							
				case"CR":
					return CR;		
					
				case"BL":
					return BL;
					
					
				case"BC":
					return BC;
					
				case"BR":
					return BR;	
					
				default:
					return CC;
			}
		}
	}
}
